package org.jspresso.model.service;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import org.jspresso.framework.application.backend.BackendControllerHolder;
import org.jspresso.framework.model.component.service.AbstractComponentServiceDelegate;
import org.jspresso.framework.model.component.service.IComponentService;
import org.jspresso.framework.model.descriptor.IComponentDescriptor;
import org.jspresso.framework.model.descriptor.IPropertyDescriptor;
import org.jspresso.framework.model.entity.IEntity;
import org.jspresso.model.IPropertiesExludable;
import org.jspresso.model.ITraceable;

/**
 * Generated by Jspresso Developer Studio
 */
public class IPropertiesExludableServiceDelegate 
      extends AbstractComponentServiceDelegate<IPropertiesExludable>
      implements IPropertiesExludableService, IComponentService {
	
	private static Set<IPropertyDescriptor> excluded;
	
	public Collection<IPropertyDescriptor> getExludedPropertie() {
		IComponentDescriptor<?> componentDesc = BackendControllerHolder.getCurrentBackendController().getEntityFactory().getComponentDescriptor(((IEntity)getComponent()).getComponentContract());
		if(excluded == null) {
			excluded = new HashSet<IPropertyDescriptor>();
			excluded.add(componentDesc.getPropertyDescriptor(ITraceable.CREATED_TIMESTAMP));
			excluded.add(componentDesc.getPropertyDescriptor(IEntity.ID));
			excluded.add(componentDesc.getPropertyDescriptor(IEntity.VERSION));
		}
		return excluded;
	}
        
}